<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <title>故障单车登记</title>
    <link rel="stylesheet" href="../layui/css/layui.css">
    <style>
        body {
            background-color: #f2f2f2;
            font-family: 'Arial', sans-serif;
        }

        .layui-container {
            width: 500px;
            margin: 0 auto;
            background-color: #fff;
            padding: 20px;
            border-radius: 5px;
            box-shadow: 0 0 10px rgba(0, 0, 0, 0.1);
            margin-top: 20px;
        }

        .layui-form-item {
            margin-bottom: 20px;
            width: 68%;
            margin-left: 76px;
        }

        .layui-form-label {
            height: 43px;
            line-height: 26px;
            width: 100px;
            text-align: right;
            font-weight: bold;
        }

        .layui-input-block {
            margin-left: 120px;
        }

        .layui-btn {
            margin-top: 10px;
        }
    </style>
</head>

<body>
<div class="layui-container">
    <form class="layui-form layui-form-pane" action="">
        <div style="text-align: center;margin-bottom: 15px;">
            <p1 style="font-size:28px;">故障单车登记</p1>
        </div>
        <div class="layui-form-item">
            <label class="layui-form-label">单车ID</label>
            <div class="layui-input-inline">
                <input type="text" name="repairID" id="repairID"  lay-verify="title" autocomplete="off" class="layui-input">
            </div>
        </div>
        <div class="layui-form-item">
            <label class="layui-form-label">单车编号</label>
            <div class="layui-input-inline">
                <input type="text" name="bicycleNumber" id="bicycleNumber"  lay-verify="title" autocomplete="off" class="layui-input">
            </div>
        </div>
        <div class="layui-form-item">
            <label class="layui-form-label">单车位置</label>
            <div class="layui-input-inline">
                <input type="text" name="location" id="location"  lay-verify="title" autocomplete="off" class="layui-input">
            </div>
        </div>
        <div class="layui-form-item">
            <label class="layui-form-label">故障说明</label>
            <div class="layui-input-inline">
                <input type="text" name="yourReason" id="yourReason"  lay-verify="title" autocomplete="off" class="layui-input">
            </div>
        </div>
        <div class="layui-form-item">
            <label class="layui-form-label">是否处理</label>
            <div class="layui-input-inline">
                <input type="text" name="isRevert" id="isRevert"  lay-verify="title" autocomplete="off" class="layui-input">
            </div>
        </div>
        <div class="layui-form-item">
            <div class="layui-input-block">
                <button class="layui-btn layui-btn-primary" lay-submit lay-filter="formDemo">提交</button>
            </div>
        </div>
    </form>
</div>

<script src="../layui/layui.js"></script>
<script src="../js/public.js"></script>
<script>
    layui.use(['form', 'layer', 'table'], function () {
        var table = layui.table, form = layui.form, $ = layui.$;
        var element = layui.element;
        var $ = layui.jquery;
        form.on('submit(formDemo)', function(data) {
            var geturl = url + user.rideRepair;
            // 获取所有的个人信息
            $.ajax({
                type: "POST",
                url: geturl,
                data: JSON.stringify(data.field), // 将表单数据转为JSON字符串
                contentType: 'application/json',
                success: function (data) {
                    console.log(data)
                    if (data.data.state === "200"){
                        var storage = window.localStorage;
                        storage.setItem("repairID",$("#repairID").val());
                        storage.setItem("bicycleNumber",$("#bicycleNumber").val());
                        storage.setItem("location",$("#location").val());
                        storage.setItem("yourReason",$("#yourReason").val());
                        storage.setItem("isRevert",$("#isRevert").val());
                        setTimeout(function () {
                            layer.msg('登记成功！');
                        }, 1000); // 延迟2秒跳转
                    }
                }
            });
        })
    });
</script>
</body>

</html>
